#include <stdio.h>
#include <malloc.h>

extern struct node
{
    int id;
    char buff[255];
    struct buff *next;
};

extern struct node *create();

extern struct node *add(struct node *head, struct node *last);

struct node *create()
{
    struct node *head, *p1, *p2;
    int num = 0;
    p1 = p2 = malloc(sizeof(struct node));
    scanf("%d,%s", &p1 -> id, &p1 -> buff);
    head = NULL;
    while(p1 -> id != 0)
    {
        num ++;
        if(num == 1) head = p1;
        else p2 -> next = p1;
        p2 = p1;
        p1 = malloc(sizeof(struct node));
        scanf("%d,%s", &p1 -> id, &p1 -> buff);
    }
    p2 -> next = NULL;
    return head;
}

struct node *add(struct node *head,struct node *last)
{
    struct node *p;
    p = head;
    printf("%d, %s\n", p->id, p->buff);
    while (p->next != NULL){
        p = p->next;
        printf("%d, %s\n", p->id, p->buff);
    }
    p -> next = last;
    /*struct node *p;
    p = head;
    while(p->next != NULL)
    {

    }
    p->next = last;*/
    return head;
}


/*int main()
{
    struct user *p;
    p = create();
    printf("%d, %s", p->id, p->name);
    return 0;
}*/
